package com.aaa.controller;

import com.aaa.entity.Staff;
import com.aaa.service.OrderdetailsService;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.text.ParseException;
import java.util.List;
import java.util.Map;

@RequestMapping("orderdetails")
@RestController
public class OrderdetailsController {
    @Resource
    private OrderdetailsService orderdetailsService;
    @RequestMapping("findbyOdid")
    public List<Map<String,Object>> findbyOdid(Integer oid) throws ParseException {
        return orderdetailsService.findbyOdid(oid);
    }
    @RequestMapping("xufang")
    public Integer xufang(Authentication authentication,Integer odid, String checkout, double money, String remark, String day){
        Integer staff = ((Staff) authentication.getPrincipal()).getId();
        return orderdetailsService.xufang(odid,checkout,money,remark,day,staff);
    }
}
